-
Notifications
You must be signed in to change notification settings - Fork 73
[oauth2] Add isClosed and exception handling for closed state to oaut… #2089
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Should we just not set |
Would also be fine for me. This would at least avoid the 'Null check operator used on a null value' error. Is it okay to make a fixup commit here? Or should I just amend my existing commit? |
Package publishing
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. |
PR HealthBreaking changes ✔️
This check can be disabled by tagging the PR with Changelog Entry ❗
Changes to files need to be accounted for in their respective changelogs. This check can be disabled by tagging the PR with Coverage ✔️
This check for test coverage is informational (issues shown here will not fail the PR). This check can be disabled by tagging the PR with API leaks ✔️The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
This check can be disabled by tagging the PR with License Headers ✔️
All source files should start with a license header. Unrelated files missing license headers
This check can be disabled by tagging the PR with |
@sigurdm friendly ping! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading this again see http.Client
doesn't have a isClosed()
method. That suggests to me the OauthClient also shouldn't. Usually you should know if the client has been closed or not from the state of your code.
I think it is valuable to remove the "_httpClient = null" from the close()
method. That should avoid the null pointer reference.
And yes, it is very fine to just push more commits to the same PR.
56aac36
to
83b8e6f
Compare
@sigurdm Thank you for the suggestions. I amended the commit and also adapted the commit message. The branch name doesn't fit 100%, but if that matters, I could open a new PR. |
The branch name has no effect. Don't mind that :) |
I see there is a lint triggering. Could you fix that? |
83b8e6f
to
19e3781
Compare
Done :) |
Until now there is no way to detect whether an oauth2.Client is closed or not. This PR changes that.
There is now an isClosed field on the oauth2.Client.
A request on a closed client no longer leads to a 'Null check operator used on a null value' error, but instead an http.ClientException is thrown with a meaningful error message.
Contribution guidelines:
dart format
.Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.